| Conditions | 2 |
| Total Lines | 9 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | import {ObserverAdapter, OnChangeCallback} from '@enbock/state-value-observer/ValueObserver'; |
||
| 26 | |||
| 27 | loadData<Type>(key: string, initialValue: Type): Type { |
||
| 28 | 2 | const serializedJsonData: string | null = this.storage.getItem(this.domain + '::' + key); |
|
| 29 | 2 | let data: Type = initialValue; |
|
| 30 | 2 | if (serializedJsonData != null) { |
|
| 31 | 1 | data = JSON.parse(serializedJsonData) as Type; |
|
| 32 | } |
||
| 33 | |||
| 34 | 2 | return data; |
|
| 35 | } |
||
| 41 |